![]() |
ControlUserPaneKeyDownProcPtr |
||||
Header: | ControlDefinitions.h | Carbon status: | Supported | |
Handles keyboard event processing.
typedef ControlPartCode(* ControlUserPaneKeyDownProcPtr) ( ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers );
You would declare your function like this if you were to name it MyControlUserPaneKeyDownCallback:
ControlPartCode MyControlUserPaneKeyDownCallback ( ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers );
A handle to the control in which the keyboard event occurred.
The virtual key code derived from event structure. This value represents the key pressed or released by the user. It is always the same for a specific physical key on a particular keyboard regardless of which modifier keys were also pressed.
A particular character derived from the event structure. This value depends on the virtual key code, the state of the modifier keys, and the current 'KCHR' resource.
The constant in the modifiers field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted.
The part code of the control where the keyboard event occurred. If the keyboard event did not occur in a control, your function should return kControlNoPart.0
The Control Manager defines the data type UserPaneKeyDownUPP to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneKeyDownUPP;
You typically use the NewControlUserPaneKeyDownProc macro like this:
ControlUserPaneKeyDownUPP myControlUserPaneKeyDownUPP;
myControlUserPaneKeyDownUPP = NewControlUserPaneKeyDownProc(MyControlUserPaneKeyDownCallback);
You typically use the CallControlUserPaneKeyDownProc macro like this:
CallControlUserPaneKeyDownProc(myControlUserPaneKeyDownUPP, control, keyCode, charCode, modifiers);
Your MyUserPaneKeyDownCallback function should handle the key pressed or released by the user and return the part code of the control where the keyboard event occurred. This function is called only if you’ve set the kControlSupportsFocus feature bit on creation of the user pane control.
Once you have provided a user pane application-defined function, you can call the function SetControlData in order to associate your function with a control. User pane application-defined functions are identified to SetControlData by tag constants; for a description of the tag constants, see the “Control Manager Constants” section. For example, once you have created the function MyControlUserPaneKeyDownCallback, pass kControlUserPaneKeyDownProcTag in the tagName parameter of SetControlData.
This function is available with Appearance Manager 1.0 and later.
Supported in Carbon.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)